package com.damage.common.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

import java.beans.Transient;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Order implements Serializable {

    private Integer id;                 //订单编号
    private String processInstanceId;   //对应流程实例的编号
    private Integer purchasePlanId;     //对应的采购计划
    private String orderSender;         //订单发送人
    private String orderReceiver;       //订单接受人
    private Double totalPrice;          //订单的总价格
    private String phone;               //订单负责人联系电话
    private String remark;              //订单备注
    private Integer state;              //订单状态（0未发送，1已发送，2已完成，3过时的，4已确认，5已取消，6已发货）
    private Timestamp sendTime;         //发送订单时间
    private Timestamp createTime;       //创建时间
    private List<OrderDetail> details;  //订单详情

    /**
     * 临时属性
     */
    private Task task;  //流程任务

    private Map<String, Object> variables;  //流程变量

    private ProcessInstance processInstance;    //运行中的流程实例

    private HistoricProcessInstance historicProcessInstance;    //历史的流程实例

    private ProcessDefinition processDefinition;    //流程定义

    @Transient
    public Task getTask() {
        return task;
    }

    @Transient
    public Map<String, Object> getVariables() {
        return variables;
    }

    @Transient
    public ProcessInstance getProcessInstance() {
        return processInstance;
    }

    @Transient
    public HistoricProcessInstance getHistoricProcessInstance() {
        return historicProcessInstance;
    }

    @Transient
    public ProcessDefinition getProcessDefinition() {
        return processDefinition;
    }
}
